import React from 'react';
import { connect } from 'dva';
import ProductList from '../../components/ProductList/index';
import './index.less'
const Products = ({ dispatch, products,user }) => {
  function handleDelete(id) {
    dispatch({
      type: 'products/delete',
      payload: id,
    });
  }
  return (
    <div>
      <h2>List of Products</h2>
      <div className="container">
        <div className="content">
          {user.userName}
        </div>
      </div>
      <ProductList onDelete={handleDelete} products={products} />
    </div>
  );
};

// export default Products;
export default connect(({ user,products }) => ({
  user,
  products,
}))(Products);